Changing frequency of a virtual programmable interrupt timer in virtual machines to control virtual time

ABSTRACT

A catch-up mode that runs a virtual programmable interrupt timer faster than a nominal rate to prevent time loss in a virtual machine can be implemented. If time loss is determined, a catch-up mode can be initiated to cause increased firings, beyond a nominal rate, of the programmable interrupt timer to adjust the clock of the virtual machine to the clock of the host system. The virtual programmable interrupt timer can also be readjusted to a predetermined nominal rate when the time loss in the guest operating system is determined approximately within a predetermined tolerance range. The catch-up mode can be monitored to avoid “interrupt storms” on the virtual machine. The virtual programmable interrupt timer can be altered by the guest operating system to accommodate different operating systems.

BACKGROUND

Some x86 guest operating systems (OS) implement periodic timing as themeans to create a software stepping signal to update their time of daycounters. These operating systems use the programmable interrupt timerto interrupt or fire at a predictable rate and update the operatingsystem counter that is used to keep track of elapsed time. Time for anoperating system can be maintained by a kernel clock and the time-of-dayclock. The time-of-day clock is derived from the kernel clock unless thetime-of-day clock is externally modified, for example, by a user. If forexample, the time-of-day clock is externally modified, the kernel clockwill not track the time-of-day clock, but will remain unchanged. Avirtualization service creates a virtual programmable interrupt timer,one or more for each virtual machine, and the virtual programmableinterrupt timer relies on a regular, periodic host operating systemcallback mechanism to accurately emulate the programmable interrupttimer for the virtual machines.

When the real programmable interrupt timer hardware is virtualized, thesoftware virtualization is not in control of certain aspects of itsoperating environment. For example, the virtualization serviceimplementing the virtual programmable interrupt timer may be preemptedby other host activity causing the virtual system to havenon-deterministic timing behavior. The virtual machines may also bepreempted either by host activity or by other virtual machines executingin the same physical system. Consequently, there may be periods of timewhen a virtual programmable interrupt timer interrupt presented to thevirtual machine may be delayed past the next expected timer period andeffectively merged with the next virtual programmable interrupt timerinterrupt. If this occurs, the virtual programmable interrupt timer mayappear to “lose time” with respect to the actual time as the interruptarrival rate becomes less than nominal. The amount of time loss in thevirtual programmable interrupt timer can range from a few seconds everyminute with a light processor load on the host to a majority of the timeevery minute with heavy processor loads on the host machine. The greaterthe loss, the more problems the virtual machine will face in operation.

Several methods have been used in the past to keep more accurate time ina virtual machine. For example; Microsoft Virtual PC implemented amethod that involved a guest operating system component periodicallyrequesting the current time from the host and subsequently setting thecorrect externally visible time in the guest operating system. The guestoperating system was informed by the host how often and whether or notto apply time correction along with the threshold of time-drift whichshould have a trigger setting a time correction.

For many aspects of x86 time-keeping, the Virtual PC method wasfunctional, however it did have several significant deficiencies.Several types of guest operating system programs such as domaincontrollers were intolerant to having the external time inside the guestoperating system suddenly “jump” forward when time was corrected. Theguest operating system's time would “jump” forward when the operatingsystem time-synchronization component realized that several seconds hadbeen “lost” and would tell the guest operating system to advance thetime. Also, the issue with time appearing to drift and run slower in theguest operating system was not addressed by this method.

In another method, the host operating system determines the location ofthe “clock” updated by the programmable interrupt timer interrupthandler in the guest operating system to prevent drifting. This methodrequired intimate knowledge of the “clock” location in the guest memoryfor a specific guest operating system. This method, therefore, had touse an added guest component to discover the “clock” location toenlighten the guest operating system of the clock position. The locationof the “clock” in the guest memory was then transmitted to the host sothat the clock was updated directly. This method was also deficientbecause it required multiple changes to be made to the guest operatingsystem. Further, the “clock” position varied in the different operatingsystems requiring additional components to be created for each operatingsystem. This method would be highly unpractical today where there is aplurality of operating systems, in contrast to the past when there wereonly a few operating systems.

In yet another method, a component of the guest operating system wasmodified to request the precise elapsed time from the virtual machine.This method allowed enlightened guest operating systems to maintainprecise, correct time. This method, however, required guest x86operating systems to either request the correct time from the host orhave the guest “advertise” the memory location of its operating system“clock.” This method was deficient because it required additional codeto inform the operating system of the location of the clock. Thus, thismethod, too, required modification of the guest operating system thatwould be unpractical today with the plurality of operating systems inuse.

Moreover, a method was invented where the steering information from theguest operating system was communicated to the virtualization service.Specifically, the clock time inside the guest operating system wastransmitted periodically to the virtualization service. This methodallowed the virtual service to calculate the difference in clock timebetween the guest operating system and host operating system so that theclock could be updated. This method was also deficient because a smallamount of time loss or drift remained even after correction by thismethod.

In view of the foregoing, there is a need to overcome the limitations,drawbacks, and deficiencies of the prior art.

SUMMARY

The following summary provides an overview of various aspects of theinvention. It is not intended to provide an exhaustive description ofall of the aspects of the invention, nor to define the scope of theinvention. Rather, this summary is intended to serve as an introductionto the detailed description and figures that follow.

The accuracy of time as perceived by the guest virtual machine issignificantly improved. An example method solves the problem ofexcessive time loss (drift) within a virtual machine (VM). The methodadaptively corrects for time loss within a virtual machine and furtheruses a feedback mechanism to ensure that time correction is applied(e.g., only when necessary) to prevent interrupt storms. Portions ofthis method remain transparent to the guest operating system such as theprogrammable interrupt timer acceleration. Other aspects such as afeedback mechanism may use a software driver to the guest operatingsystem.

A mechanism used by the virtualization service (VS) to correct for timedrift involves running the guest virtual machine's programmableinterrupt timer at a higher frequency than nominal when the VS detectsthat the guest has “lost” time. A programmable interrupt timer can be,for example, an HPET high precision event timer, a 8253 PIT, an RTC realtime clock, an ACPI PM counter, or a local APIC timer. Running theprogrammable interrupt timer at a higher frequency than nominal causestimer interrupts to be delivered to the guest operating system at afaster rate than the guest operating system had requested.

The programmable interrupt timer interrupt rate can also be monitoredand moderated to prevent an interrupt storm on the guest operatingsystem. An interrupt can be a signal informing a program or operatingsystem that an event has occurred. Interrupt signals can come from avariety of sources. For example, every keystroke generates an interruptsignal. Interrupts can also be generated by other devices, such as aprinter, for example, to indicate that some event has occurred. Theseare called hardware interrupts. Interrupt signals initiated by programsare called software interrupts.

When a program receives an interrupt signal, it can take a specifiedaction. Interrupt signals can cause a program to suspend itselftemporarily to service the interrupt. If a plurality of interruptsignals are received by a program or operating system, the interruptscan cause a long suspension causing the program or operating system tocease functioning. Receipt of a plurality of interrupt signalsultimately causing a suspension of function may be referred to as aninterrupt storm.

Monitoring and moderating the programmable interrupt timer interruptrate can prevent a failure in the guest virtual machine to make forwardprogress. Further, an optional feedback mechanism can be used to helpcorrect for time drift on the guest virtual machine.

The “lost” time budget can also be scaled appropriately whenever theguest virtual machine changes the programmable interrupt timer's periodso that the time correction code continues to make up for lost timewithout introducing a discontinuity or inaccuracy.

Additional features and advantages will be made apparent from thefollowing detailed description of illustrative embodiments that proceedswith reference to the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

The foregoing summary, as well as the following detailed description ofpreferred embodiments, is better understood when read in conjunctionwith the appended drawings. For the purpose of illustrating theinvention, there is shown in the drawings exemplary constructions of theinvention; however, the invention is not limited to the specific methodsand instrumentalities disclosed. In the drawings:

FIG. 1 is a block diagram showing an exemplary computing environment inwhich aspects of the invention may be implemented;

FIG. 2 is a diagram of an exemplary timeline useful for describing anexample of loss of time in a virtual machine;

FIG. 3 is a diagram of an exemplary timeline useful for describing anexemplary process for correcting time in a virtual machine in accordancewith the invention;

FIG. 4 is a block diagram illustrating an example host/guest operatingsystem hierarchy in accordance with the invention; and

FIG. 5 is a flow diagram depicting an exemplary method for correctingtime drift in accordance with the invention.

DETAILED DESCRIPTION OF ILLUSTRATIVE EMBODIMENTS

Overview

The proper maintenance of the correct time in a guest operating systemis a factor that can affect the performance of a virtual machine. Lossof time in a guest operating system can be detrimental to the virtualmachine in several subtle ways. For example, watching a clock within theguest operating system while watching a similar clock in the hostoperating system may show time to be slowly losing several seconds ofevery minute. The guest operating system clock will appear to lag behindthe host operating system clock. Apparent lags in time can bedetrimental to programs and processes being performed in the guestoperating system.

Additionally, timers, and services within the guest virtual machinewhich expect an absolute amount of time to elapse will not perceive thecorrect amount of time elapsing. For example, the scheduling ofprocesses and threads by the guest operating system kernel schedulerlags real elapsed time on the host. If the guest slowdown issignificant, time slicing of threads within a guest operating system isseverely perturbed.

Mechanisms used by a virtual system to emulate the timer interrupts arenot accurate due to various reasons. For example, time-slicing of thevirtual processor may delay guest interrupts. Additionally, other hostactivity may delay the guest interrupts. Moreover, the precision of thetiming facilities available to the virtual machine may not be highenough, thus delays in the guest interrupts may occur.

To address the time loss issue and the inaccuracies of the mechanismsused to emulate the timer interrupts, a more accurate time-keepingmechanism can be utilized. A “catch-up” mode that runs the virtualprogrammable interrupt timer faster than a nominal rate can beimplemented. Nominal can be defined, for example, as the expected rate aguest operating system programs the programmable interrupt timer tofire. It is desirable to avoid running the catch-up mode too often,thereby avoiding an “interrupt storm” on the virtual machine where theguest operating system is incapable of making forward progress due tothe large number of interrupt requests.

Exemplary Computing Environment

FIG. 1 illustrates an example of a suitable computing system environment100 in which the invention may be implemented. The computing systemenvironment 100 is only one example of a suitable computing environmentand is not intended to suggest any limitation as to the scope of use orfunctionality of the invention. Neither should the computing environment100 be interpreted as having any dependency or requirement relating toany one or combination of components illustrated in the exemplaryoperating environment 100.

The invention is operational with numerous other general purpose orspecial purpose computing system environments or configurations.Examples of well known computing systems, environments, and/orconfigurations that may be suitable for use with the invention include,but are not limited to, personal computers, server computers, hand-heldor laptop devices, multiprocessor systems, microprocessor-based systems,set top boxes, programmable consumer electronics, network PCs,minicomputers, mainframe computers, distributed computing environmentsthat include any of the above systems or devices, and the like.

The invention may be described in the general context ofcomputer-executable instructions, such as program modules, beingexecuted by a computer. Generally, program modules include routines,programs, objects, components, data structures, etc. that performparticular tasks or implement particular abstract data types. Theinvention may also be practiced in distributed computing environmentswhere tasks are performed by remote processing devices that are linkedthrough a communications network or other data transmission medium. In adistributed computing environment, program modules and other data may belocated in both local and remote computer storage media including memorystorage devices.

With reference to FIG. 1, an exemplary system for implementing theinvention includes a general purpose computing device in the form of acomputer 110. Components of computer 110 may include, but are notlimited to, a processing unit 120, a system memory 130, and a system bus121 that couples various system components including the system memoryto the processing unit 120. The system bus 121 may be any of severaltypes of bus structures including a memory bus or memory controller, aperipheral bus, and a local bus using any of a variety of busarchitectures. By way of example, and not limitation, such architecturesinclude Industry Standard Architecture (ISA) bus, Micro ChannelArchitecture (MCA) bus, Enhanced ISA (EISA) bus, Video ElectronicsStandards Association (VESA) local bus, and Peripheral ComponentInterconnect (PCI) bus (also known as Mezzanine bus).

Computer 110 typically includes a variety of computer readable media.Computer readable media can be any available media that can be accessedby computer 110 and includes both volatile and nonvolatile media,removable and non-removable media. By way of example, and notlimitation, computer readable media may comprise computer storage mediaand communication media. Computer storage media includes both volatileand nonvolatile, removable and non-removable media implemented in anymethod or technology for storage of information such as computerreadable instructions, data structures, program modules or other data.Computer storage media includes, but is not limited to, RAM, ROM,EEPROM, flash memory or other memory technology, CD-ROM, digitalversatile disks (DVD) or other optical disk storage, magnetic cassettes,magnetic tape, magnetic disk storage or other magnetic storage devices,or any other medium which can be used to store the desired informationand which can accessed by computer 110. Communication media typicallyembodies computer readable instructions, data structures, programmodules or other data in a modulated data signal such as a carrier waveor other transport mechanism and includes any information deliverymedia. The term “modulated data signal” means a signal that has one ormore of its characteristics set or changed in such a manner as to encodeinformation in the signal. By way of example, and not limitation,communication media includes wired media such as a wired network ordirect-wired connection, and wireless media such as acoustic, RF,infrared and other wireless media. Combinations of any of the aboveshould also be included within the scope of computer readable media.

The system memory 130 includes computer storage media in the form ofvolatile and/or nonvolatile memory such as ROM 131 and RAM 132. A basicinput/output system 133 (BIOS), containing the basic routines that helpto transfer information between elements within computer 110, such asduring start-up, is typically stored in ROM 131. RAM 132 typicallycontains data and/or program modules that are immediately accessible toand/or presently being operated on by processing unit 120. By way ofexample, and not limitation, FIG. 1 illustrates operating system 134,application programs 135, other program modules 136, and program data137.

The computer 110 may also include other removable/non-removable,volatile/nonvolatile computer storage media. By way of example only,FIG. 1 illustrates a hard disk drive 140 that reads from or writes tonon-removable, nonvolatile magnetic media, a magnetic disk drive 151that reads from or writes to a removable, nonvolatile magnetic disk 152,and an optical disk drive 155 that reads from or writes to a removable,nonvolatile optical disk 156, such as a CD-ROM or other optical media.Other removable/non-removable, volatile/nonvolatile computer storagemedia that can be used in the exemplary operating environment include,but are not limited to, magnetic tape cassettes, flash memory cards,digital versatile disks, digital video tape, solid state RAM, solidstate ROM, and the like. The hard disk drive 141 is typically connectedto the system bus 121 through a non-removable memory interface such asinterface 140, and magnetic disk drive 151 and optical disk drive 155are typically connected to the system bus 121 by a removable memoryinterface, such as interface 150.

The drives and their associated computer storage media, discussed aboveand illustrated in FIG. 1, provide storage of computer readableinstructions, data structures, program modules and other data for thecomputer 110. In FIG. 1, for example, hard disk drive 141 is illustratedas storing operating system 144, application programs 145, other programmodules 146, and program data 147. Note that these components can eitherbe the same as or different from operating system 134, applicationprograms 135, other program modules 136, and program data 137. Operatingsystem 144, application programs 145, other program modules 146, andprogram data 147 are given different numbers here to illustrate that, ata minimum, they are different copies. A user may enter commands andinformation into the computer 110 through input devices such as akeyboard 162 and pointing device 161, commonly referred to as a mouse,trackball or touch pad. Other input devices (not shown) may include amicrophone, joystick, game pad, satellite dish, scanner, or the like.These and other input devices are often connected to the processing unit120 through a user input interface 160 that is coupled to the systembus, but may be connected by other interface and bus structures, such asa parallel port, game port or a universal serial bus (USB). A monitor191 or other type of display device is also connected to the system bus121 via an interface, such as a video interface 190. In addition to themonitor, computers may also include other peripheral output devices suchas speakers 197 and printer 196, which may be connected through anoutput peripheral interface 195.

The computer 110 may operate in a networked environment using logicalconnections to one or more remote computers, such as a remote computer180. The remote computer 180 may be a personal computer, a server, arouter, a network PC, a peer device or other common network node, andtypically includes many or all of the elements described above relativeto the computer 110, although only a memory storage device 181 has beenillustrated in FIG. 1. The logical connections depicted include a localarea network (LAN) 171 and a wide area network (WAN) 173, but may alsoinclude other networks. Such networking environments are commonplace inoffices, enterprise-wide computer networks, intranets and the Internet.

When used in a LAN networking environment, the computer 110 is connectedto the LAN 171 through a network interface (wired or wireless) oradapter 170. When used in a WAN networking environment, the computer 110typically includes a modem 172 or other means for establishingcommunications over the WAN 173, such as the Internet. The modem 172,which may be internal or external, may be connected to the system bus121 via the user input interface 160, or other appropriate mechanism. Ina networked environment, program modules depicted relative to thecomputer 110, or portions thereof, may be stored in the remote memorystorage device. By way of example, and not limitation, FIG. 1illustrates remote application programs 185 as residing on memory device181. It will be appreciated that the network connections shown areexemplary and other means of establishing a communications link betweenthe computers may be used.

Exemplary Embodiments

FIG. 2 illustrates how time loss may occur in a virtual machine.Initially, the expected timer durations are predetermined across thetime spectrum and are labeled as 1-14. With the virtual system runningwithout any interruptions or preemptions, the expected firings occur atexpected firings 1-3 without causing time loss.

As illustrated in FIG. 2, the VM is preempted between expected firings 3and 7 where only one (1) out of an expected three (3) firings occur. Atthat point in time, there is “time loss” because the guest operatingsystem only shows, for example, 10 milliseconds having passed while, inreality, 30 milliseconds have passed.

Further interruptions or preemptions occur, as illustrated in FIG. 2,between expected firings 8-10 where no firings occur. The guest system,therefore, may be behind another 30 milliseconds because no firingsoccurred during the expected firing period. Over the course of time fromexpected firing 4 and through expected firing 11, only three (3) out ofthe expected eight (8) firings occur because of preemption, for example.The loss of the expected five firings can result in time loss in theguest virtual machine. If the timer duration is 10 milliseconds, forexample, approximately 30 milliseconds will appear to elapse inside theguest virtual machine instead of the true 80 milliseconds. The time lossis undesirable.

FIG. 3 illustrates a diagram useful for describing correcting time lossin a virtual machine in accordance with the invention. Initially, theexpected timer durations are predetermined across the time spectrum andare labeled as 1-14. In a “normal mode” with no interruptions, thefirings occur as expected at 1, 2, and 3, respectively.

In between expected firing 4 and expected firing 6, however, the firingsare delayed or interrupted and none of the expected firings occur duringthat time. Because there is a delay in the firings, a catch-up mode isinitialized and firings start to occur at an increased rate as shownbetween expected firing 6 and expected firing 11.

Once the actual firings equal or fall within a predetermined tolerancewith the expected firings during the time loss period, the system canshift back to normal mode as shown between expected firing 11 andexpected firing 12. The system then reverts back to firing only at theexpected times. If, however, there is another loss of time because of aninterrupt, a catch-up mode can again be initialized to keep the guestoperating system time within tolerance.

A catch-up mode can be entered independently from a guest operatingsystem or it can be optionally augmented with additional data from theguest, for example. Specifically, the guest operating system canperiodically provide feedback data on how much time loss occurred over apredetermined time and can cause the time-keeping state machine to enteror exit a catch-up mode. The guest operating system can provide what itbelieves is the current time to the virtualization service on the hostoperating system. The host operating system can then take the guest timeand compare it with the actual time and determine the difference intimes for the operating systems. This difference in time, or ΔT, can becalculated by the host operating system and sent specifically to theprogrammable interrupt timer to cause the programmable interrupt timerinto catch-up mode if the ΔT falls outside a predetermined tolerancerange. The feedback data can help to alleviate the number of occurrenceswhen the guest operating system desirably enters a catch-up mode toratchet the guest external time forward and potentially disturb atime-sensitive service, for example a domain controller. The feedbackdata can also correct for minor time losses that may have occurred inthe guest operating system.

The time correction code and the code used to determine the amount oftime to run the virtual processor of the guest virtual machine desirablycooperate and interact with each other. Their cooperation greatlyreduces the amount of waiting time which can take place in order toprocess high-resolution timers.

While the methods described above reference interactions between a hostoperating system and a guest operating system, the methods describedherein are not limited for use to only two systems. For example, FIG. 4illustrates a host/guest operating system hierarchy in accordance withthe invention. A traditional host operating system 410 is shown alongwith guest operating systems 420-440. There may, however, be multiplelevels or layers of subsystems as shown in FIG. 4. For example, 450 canbe a guest operating system of the guest operating system 420 that, inturn, is a guest operating system of the host operating system 410.Further, 470 is a guest operating system on the guest operating system460 that is a guest operating system on the guest operating system 440that is a guest operating system on the host operating system 410.

As illustrated in FIG. 4, for example, a guest operating system may be ahost operating system to a lower level guest operating system. Theexemplary methods described herein can be used at any level of ahost/guest hierarchy for preventing time loss on the guest system.

FIG. 5 illustrates an exemplary method for detecting and correcting timeloss in a virtual machine in accordance with the invention. Initially,the virtual machine is running on a host machine at step 505. Thevirtual machine waits for the host timer expiration or firing at step510.

Once the host timer expires, the virtual machine can determine the timelapse between the expected timer expiration time and the actual timerexpiration time at step 515. If the lapse is within a predeterminedtolerance at step 520, then the virtual machine can again wait for thenext host timer expiration or firing at step 510. If, however, the lapseis not within the predetermined tolerance at step 520, then the virtualmachine can initiate “catch-up” mode to correct the time loss at step525. The predetermined tolerance at step 520 can be a 5 second timelapse, for example.

The rate of fire for the host time can be increased at step 530 andafter a predetermined time, the virtual machine can then assess if therewere sufficient firings of the host time to catch up or adjust the timeof the guest operating system with the time of the host operating systemat step 540. In performing this function, a feedback mechanism can beused to further verify the guest time at step 535.

If the time lapse now is within a predetermined tolerance at step 545,the virtual machine can then resume a nominal host timer expiration rateor firing at step 550 and wait for the host expiration timer to expireat step 510. If, however, the lapse is still not within a predeterminedtolerance at step 545, a catch-up mode can continue and furtherdeterminations can be performed to determine if the time of the guestoperating system is within a predetermined tolerance of the hostoperating system at steps 540-545. The predetermined tolerance at step545 can be a 1 second time lapse, for example.

Additionally, a fail safe mechanism can be implemented to preventfurther firings in catch-up mode if it is determined that the guestoperating system will cause interrupt storms or will never catch up withthe host operating system time. The fail safe mechanism may initiate if,for example, the time lapse is greater than 30 seconds.

The period of the guest programmable interrupt timer can also be changedby the guest operating system to accommodate different operatingsystems. For example, in the Microsoft Windows XP operating system, theperiod of the guest programmable interrupt timer may be 1 or 10milliseconds, for example. A 1 millisecond duration, for example, may beused for multimedia timing such as sound or video applications. The timecorrection algorithms compensate for the dynamic nature of theprogrammable interrupt timer duration by scaling the number oftimer-firings expected and timer-firings succeeded at the moment thatthe programmable interrupt timer duration is changed.

The various techniques described herein may be implemented with hardwareor software or, where appropriate, with a combination of both. Thus, themethods and apparatus of the present invention, or certain aspects orportions thereof, may take the form of program code (i.e., instructions)embodied in tangible media, such as floppy diskettes, CD-ROMs, harddrives, or any other machine-readable storage medium, wherein, when theprogram code is loaded into and executed by a machine, such as acomputer, the machine becomes an apparatus for practicing the invention.One or more programs are preferably implemented in a high levelprocedural or object oriented programming language to communicate with acomputer system. However, the program(s) can be implemented in assemblyor machine language, if desired. In any case, the language may be acompiled or interpreted language, and combined with hardwareimplementations.

The methods of the present invention may also be embodied in the form ofprogram code that is transmitted over some transmission medium, such asover electrical wiring or cabling, through fiber optics, or via anyother form of transmission, wherein, when the program code is receivedand loaded into and executed by a machine, such as an EPROM, a gatearray, a programmable logic device (PLD), a client computer, a videorecorder or the like, the machine becomes an apparatus for practicingthe invention. When implemented on a general-purpose processor, theprogram code combines with the processor to provide a unique apparatusthat operates to perform the versioning functionality of the presentinvention.

It is noted that the foregoing examples have been provided merely forthe purpose of explanation and are in no way to be construed as limitingof the present invention. While the invention has been described withreference to various embodiments, it is understood that the words whichhave been used herein are words of description and illustration, ratherthan words of limitations. Further, although the invention has beendescribed herein with reference to particular means, materials andembodiments, the invention is not intended to be limited to theparticulars disclosed herein; rather, the invention extends to allfunctionally equivalent structures, methods and uses, such as are withinthe scope of the appended claims.

What is claimed:
 1. A method for correcting time within a virtualmachine, comprising: detecting, by a virtualization service running on ahost operating system, a time in a guest operating system executing onthe virtual machine wherein the time is based on a virtual programmableinterrupt timer of the virtual machine firing at a nominal rate;determining that a time lapse occurred between an expected timerexpiration time of the virtual machine and an actual timer expirationtime of the host operating system is outside a predetermined tolerancerange; adjusting the virtual programmable interrupt timer, responsive tothe occurrence of the time loss, by increasing the virtual programmableinterrupt timer firings above the nominal rate; and returning thevirtual programmable interrupt timer to fire at the nominal rate afterthe time loss in the guest operating system is within the predeterminedtolerance range.
 2. The method of claim 1, further comprising receivingfeedback from a feedback mechanism.
 3. The method of claim 2, whereinthe feedback comprises a time difference between guest operating systemand the host operating system.
 4. The method of claim 3, furthercomprising determining the time difference using the feedback from thefeedback mechanism.
 5. The method of claim 1, wherein the nominal rateis based on a privilege code in the operating system.
 6. The method ofclaim 1, further comprising monitoring the virtual programmableinterrupt timer to prevent an interrupt storm on the quest operatingsystem.
 7. The method of claim 1, wherein the quest operating systemacts as a host operating system to another operating system.
 8. Themethod of claim 1, further comprising altering the virtual programmableinterrupt timer to accommodate a plurality of operating systems.
 9. Asystem for preventing excessive time loss in an operating system,comprising: a computing device; a memory in communication with saidcomputing device when the system is operational; a first operatingsystem stored in said memory and executable on said computing device;and a second operating system stored in said memory and executable on avirtual machine, said virtual machine comprising a programmableinterrupt timer that operates at a nominal frequency that enables saidsecond operating system to keep time, wherein a frequency of theprogrammable interrupt timer can be temporarily increased to adjust timein said second operating system caused by an interruption in the virtualmachine execution by determining that a time lapse between an expectedtimer expiration time of the virtual machine and an actual timerexpiration time of the first operating system is outside a predeterminedtolerance range, wherein the frequency of the programmable interrupttimer is returned to the nominal frequency when a time loss in saidsecond operating system is determined to be within a predeterminedtolerance range.
 10. The system of claim 9, wherein the first operatingsystem comprises a host operating system and the second operating systemcomprises a virtual operating system.
 11. The system of claim 9, whereinthe first operating system comprises a first virtual operating systemand the second operating system comprises a second virtual operatingsystem.
 12. The system of claim 9, wherein the second operating systemdetermines a second operating system current time and communicates thesecond operating system current time to the first operating system. 13.The system of claim 12, wherein the first operating system determinesthe time loss of the second operating system using the second operatingsystem current time.
 14. A computer readable storage medium, which doesnot include signals, having computer-executable instructions forcarrying out the acts, comprising: detecting, by a virtualizationservice running on a host operating system, a time loss in a guestoperating system executing on a virtual machine caused by aninterruption of the virtual machine execution by determining that a timelapse between an expected timer expiration time of the virtual machineand an actual timer expiration time of the host operating system isoutside a predetermined tolerance range; entering a catch-up mode byrunning a virtual programmable interrupt timer of the virtual machine ata rate greater than a nominal rate when the time loss in the virtualmachine is detected; and exiting the catch-up mode when the time loss iswithin a predetermined tolerance range.
 15. The computer readablestorage medium of claim 14, further comprising a normal mode wherein thevirtual programmable interrupt timer fires at the nominal rate.
 16. Thecomputer readable storage medium of claim 14, further comprisinginstructions for receiving feedback from a feedback mechanism, whereinthe feedback comprises a time of the guest operating system, andcomparing the time of the guest operating system with a time of the hostoperating system clock and if a time difference between the guestoperating system clock and the host operating system clock is greaterthan the predetermined tolerance range, entering the catch-up mode tocorrect for the time difference.